﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using DTO;

namespace DAO
{
    public class ChiTietVeDatDAO
    {
        DataProvider dp = new DataProvider();
        public DataTable LayDanhSachMaPhim()
        {
            return dp.SqlExcuteQuery("sp_LayDanhSachMaPhim");
        }
        public DataTable LayDanhSachDoiTuong()
        {
            return dp.SqlExcuteQuery("sp_LayDanhSachDoiTuong");
        }
        public DataTable LayDanhSachCaChieu()
        {
            return dp.SqlExcuteQuery("sp_LayDanhSachMaCaChieu");
        }
        public DataTable LayDanhSachTinhTrang()
        {
            return dp.SqlExcuteQuery("sp_LayDanhSachTinhTrang");
        }
        public DataTable LayDanhSachChiTietVeDat()
        {
            return dp.SqlExcuteQuery("sp_LayDanhSachChiTietVeDat");
        }
        public DataTable LayMaPhimTheoTenPhim(string tenPhim)
        {
            SqlParameter param = new SqlParameter("@TenPhim", tenPhim);
            return dp.SqlExcuteQuery("sp_LayMaPhimTheoTenPhim", param);
        }
        public void ThemChiTietVeDat(ChiTietVeDatDTO ctvd)
        {
            SqlParameter[] param = {
                                     new SqlParameter("@MaDoiTuong",ctvd.MaDoiTuong),
                                     new SqlParameter("@SoLuongVe",ctvd.SoLuongVe ),
                                     new SqlParameter("@SoGhe",ctvd.SoGhe ),
                                     new SqlParameter("@MaPhim",ctvd.MaPhim ),
                                     new SqlParameter("@MaCaChieu",ctvd.MaCaChieu ),
                                     new SqlParameter("@GiaVe",ctvd.GiaVe ),
                                     new SqlParameter("@TongTien",ctvd.TongTien ),
                                     new SqlParameter("@MaTinhTrang",ctvd.MaTinhTrang ),       
                                   };
            dp.SqlExcuteNonQuery("sp_ThemChiTietVeDat", param);

        }

    }
}
   